package view;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Polygon;

import model.LittleAnt;

public class LittleAntView implements Paintable {
	
	private LittleAnt littleant;
	private int prevlocx;
	private int prevlocy;

	public LittleAntView(LittleAnt lant){
		
		littleant=lant;
		prevlocx = (int) lant.get_x();
		prevlocx = (int) lant.get_y();
	}
	@Override
	public void paint(Graphics g) {
		int loc_x=(int)littleant.get_x();
		int loc_y=(int)littleant.get_y();
		
		//kirajzol egy piros haromszoget
		  g.setColor(Color.red);
		  Polygon p=new Polygon();
		  p.addPoint(loc_x-5, loc_y+5);
		  p.addPoint(loc_x+5, loc_y+5);
		  p.addPoint(loc_x, loc_y-10);
		  //a haromszog ures, ha a hangya meg kajat keres
		  if(!littleant.isGoingHome()){
		  g.drawPolygon(p);
		  }
		  else{
		  //teli, ha van kaja a hatan
		  g.fillPolygon(p);

	}
	}

	@Override
	public boolean alive() {
		return littleant.getIsAlive();
	}
	
}
